package com.bqtv.sport.ui

import android.content.Context
import android.content.Intent
import android.view.View
import com.gyf.immersionbar.BarHide
import com.gyf.immersionbar.ImmersionBar
import com.bqtv.sport.app.AppActivity
import com.bqtv.sport.commen.utils.countdown.CountDownUtils
import com.bqtv.sport.commen.utils.countdown.TickListener
import com.bqtv.sport.databinding.ActivitySplashBinding

class SplashActivity : AppActivity<ActivitySplashBinding>(), TickListener {
    companion object {
        fun start(context: Context) {
            val intent = Intent(context, SplashActivity::class.java)
            context.startActivity(intent)
        }
    }

    private var downUtils: CountDownUtils? = null

    override fun getViewBinding() = ActivitySplashBinding.inflate(layoutInflater)

    override fun createStatusBarConfig(): ImmersionBar {
        return super.createStatusBarConfig() // 隐藏状态栏和导航栏
            .hideBar(BarHide.FLAG_HIDE_BAR)
    }

    override fun initView() {

    }

    override fun initData() {
        startCountDown(2)

//        ServerConfig.setIp("http://45.207.47.25:9666")
        initListener()
    }

    private fun initListener() {
    }

    override fun onClick(view: View) {
        super.onClick(view)
    }

    private fun startCountDown(time: Int) {
        downUtils = CountDownUtils((time * 1000).toLong(), 1000, this@SplashActivity)
        downUtils!!.start()
    }

    override fun tick(time: Long) {

    }

    override fun done() {
        MainActivity.start(this)
    }
}